def A(l_start,l_remain):
    if len(l_remain) == 1:
        print(l_start + l_remain)
    else:
        for i in range(0,len(l_remain)):
            l_temp_remain = l_remain[:]
            A(l_start + [l_temp_remain.pop(i)],l_temp_remain)
            
        
        

A([],[1,2,3,4,5])